<ui:composition xmlns="http://www.w3.org/1999/xhtml"
			    xmlns:ui="http://java.sun.com/jsf/facelets"
			    xmlns:h="http://java.sun.com/jsf/html"
			    xmlns:f="http://java.sun.com/jsf/core"
			    xmlns:rich="http://richfaces.org/rich"
			    xmlns:a4j="http://richfaces.org/a4j"
			    template="/WEB-INF/layout/template.xhtml">
	
	<ui:define name="title">
		<h:outputText value="#{i18n['selectOneRadio.title']}"/>
	</ui:define>

	<ui:define name="contents">
		<h:form id="findForm">
			<h:panelGrid columns="4">
				<h:outputLabel id="nachnameLabel"
				               value="#{i18n['find.nachname.prompt']}"
				               for="nachname"/>
				
				<h:inputText id="nachname" value="#{kv.nachname}"
				             required="true"
				             requiredMessage="#{i18n['find.nachname.required']}"/>

				<rich:suggestionbox id="nachnameSuggestion"
				                    for="nachname"
				                    minChar="2"
				                    frequency="1"
				                    suggestionAction="#{kv.findNachnamenByPrefix}"
				                    nothingLabel="#{i18n['find.nachname.nothing']}"
				                    var="kunde">
				    <h:column>
						<h:outputText value="#{kunde.nachname}"/>
					</h:column>
				</rich:suggestionbox>
				
				<a4j:commandButton id="findSubmit"
				                   action="#{kv.find}"
				                   value="#{i18n['find.submit']}"
				                   reRender="selectForm, fehlermeldung, fehlermeldungen"/>			
			</h:panelGrid>
			
			<rich:message id="fehlermeldung" for="nachname" errorClass="error" warnClass="warn"/>
		</h:form>
		
		<p>
			<rich:message id="fehlermeldungen" for="selectForm" errorClass="error">
				<f:facet name="errorMarker">
					<h:graphicImage url="/images/error.gif"/>
				</f:facet>
			</rich:message>
		</p>

		<h:form id="selectForm"
		        rendered="#{not empty kv.gefundeneKunden}">
			<a4j:region>
				<h:selectOneRadio id="kundenTabelle" value="#{kv.index}"
				                  layout="pageDirection">
					<f:selectItems value="#{kv.auswahl}"/>
				</h:selectOneRadio>
	
				<h:panelGrid columns="3">
					<h:commandButton id="detailsButton" action="#{kv.detailsIndex}" value="#{i18n['details.submit']}"/>
					<h:commandButton id="updateSubmit" action="#{kv.selectForUpdateIndex}" value="#{i18n['update.submit']}"/>
					<h:commandButton id="deleteSubmit" action="#{kv.deleteIndex}" value="#{i18n['delete.submit']}"
					                 onclick="return confirm('#{i18n['delete.kunde.bestaetigung']}')"/>
				</h:panelGrid>
			</a4j:region>
		</h:form>
	</ui:define>
</ui:composition>
